package com.pdemo.core.dao;

import java.util.List;

import javax.persistence.Query;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;

import org.springframework.stereotype.Repository;

import com.pdemo.core.entity.Borrower;
import com.pdemo.core.entity.User;
import com.pdemo.core.genericdao.GenericDao;
@Repository("userDao")
public class UserDao extends GenericDao<User,Long>{
	
	public List<Borrower> getAllBorrowers(){
		CriteriaBuilder cb = entityManager.getCriteriaBuilder();
		CriteriaQuery<Borrower> cq = cb.createQuery(Borrower.class);
		cq.from(Borrower.class);
		Query query = entityManager.createQuery(cq);
		return query.getResultList();
	}
}
